package lab2;

import lab4.PartTimeJob;

import java.util.HashMap;

public class SalaryReference {
    //不同部门的基本工资
    private static final HashMap<EnumDepartment, Double> departmentSalaryMap = new HashMap<>();

    //不同级别的奖励
    private static final HashMap<EnumEmployeeLevel, Double> levelSalaryMap = new HashMap<>();

    private static final HashMap<EnumDepartment, Double> internSalaryMap = new HashMap<>();

    static {
        departmentSalaryMap.put(EnumDepartment.RD, 15000.0);
        departmentSalaryMap.put(EnumDepartment.AD, 7000.0);
        departmentSalaryMap.put(EnumDepartment.HR, 9000.0);
        departmentSalaryMap.put(EnumDepartment.FD, 8000.0);

        levelSalaryMap.put(EnumEmployeeLevel.Junior, 0.0);
        levelSalaryMap.put(EnumEmployeeLevel.Middle, 1000.0);
        levelSalaryMap.put(EnumEmployeeLevel.Senior, 5000.0);

        internSalaryMap.put(EnumDepartment.RD, 100.0);
        internSalaryMap.put(EnumDepartment.AD, 65.0);
        internSalaryMap.put(EnumDepartment.HR, 85.0);
        internSalaryMap.put(EnumDepartment.FD, 75.0);

    }

    public static Double getSalary(RegularStaff  regularStaff){
        int hours = regularStaff.getHours();
        double basicSalary = departmentSalaryMap.get(regularStaff.getDepartment())
                +levelSalaryMap.get(regularStaff.getLevel());
        double tmpSalary = 0;
        // 题目是说工资按照最后时长计算吧？
        // 超出部分每小时100，少的部分扣80每小时
        if (hours < 40){
            tmpSalary = Math.min(basicSalary-(40-hours)*80.0,0);
        }else {
            tmpSalary = basicSalary + (hours - 40)*100.0;
        }
        return tmpSalary;
    }

    public static Double getSalary(Intern intern){
        return intern.getHours()* internSalaryMap.get(intern.getDepartment());
    }
}
